package sn.gandal.agriculture.agrimobile.j2me.utilities;

import java.io.IOException;
import javax.microedition.rms.RecordStoreException;
import sn.gandal.agriculture.agrimobile.j2me.businessObjects.Adresse;
import sn.gandal.agriculture.agrimobile.j2me.businessObjects.BusinessServicesImpl;
import sn.gandal.agriculture.agrimobile.j2me.businessObjects.IBusinessServices;

/**
 *
 * @author dysow
 */
public class NetworkConfiguration
{

  //  public static String DEFAULT_WEBSITE_ADDRESS = "http://localhost/Pesinet_web/Web%201.0/gsm/dataTransfer.php";
//  public static String DEFAULT_WEBSITE_ADDRESS = "http://localhost/astek/svn/pesinet/Web%201.0/gsm/dataTransfer.php";
    public static String DEFAULT_WEBSITE_ADDRESS = "http://localhost/Pesinet/gsm/dataTransfer.php";
 //   public static String DEFAULT_WEBSITE_ADDRESS = "http://localhost/Pesinet/Web%201.0/gsm/dataTransfer.php";

    public static String RECEPTION_DONNEE_ARGUMENT = "1";
    public static String ENVOIE_DONNEE_ARGUMENT = "2";

    public String getWebsiteAddress() throws RecordStoreException, IOException
    {
	IBusinessServices iBusinessServices = BusinessServicesImpl.getInstance();
	Adresse adress = iBusinessServices.getAdresseEnregistree();
        String adresse=null;
	if (adress == null)
	{
            adresse =NetworkConfiguration.DEFAULT_WEBSITE_ADDRESS;

	}
	else
	{
	    adresse= adress.getWebAddress();
        }
        System.out.println("Adresse obtenue : "+ adresse);
        return adresse;
    }
}
